<template>
  <div id="app" style="position: relative">
    <div class="name">{{name}}</div>
    <pre class="content">{{content}}</pre>
  </div>

</template>
<script>
  import {getLogContent} from "@/api/monitor/logFile";

  export default {
    name: "index",
    data() {
      return {
        //获取路由传过来的路径
        path: "",
        name:"",
        content: "",
        dataQuery: {
          path: ""
        },
      }
    },
    methods: {
      showData() {
         console.log(this.$route)
        this.dataQuery.path = this.$route.params.name
        this.name=this.$route.params.id
        console.log("传过来的参数", this.path);
        getLogContent(this.dataQuery).then(response => {
          this.content = response.msg
        })
      }
    },
    created() {
      this.showData()
    }
  }
</script>

<style scoped>
   .name{
     position: fixed;
     width:100%;
     height:30px;
     text-align: center;
     line-height: 30px;
     background-color: greenyellow;
     top:0px;
   }
  .content{
   margin-top: 30px;
  }
</style>
